'''
Created on 04/03/2009

@author: eh01
'''
from daohelper import DAOHelper
from domain.hubuser import HubUser

class HubUserDAO(DAOHelper):
    
    def save(self, hubUser):
        """ saves the hub user """
        hubUser.put()
    def getHubUserByUsername(self, username):
        """ returns a hub user with the username provided """
        query = HubUser.gql("WHERE username = :1", username)
        hubUsers = self.copyQueryResultsToList(query)
        if hubUsers:
            """ if the list is not empty, return the first one 
                (i.e. there should only be one) """
            return hubUsers[0]
        else:
            return None
        